<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>更新学生信息</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="../layui/css/layui.css"  media="all">
  <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<%
int user_id=Integer.parseInt(request.getParameter("user_id"));
String user_name=request.getParameter("user_name");
%>
<script type="text/javascript">

</script>
<body>
   <H1>修改学生信息</H1>
   <hr>
<form class="layui-form" method="post" action="../admin/student?m=userUpdate">
    <div class="layui-form-item">
      <label class="layui-form-label">用户账号</label>
      <div class="layui-input-block">
      <input type='text' name='user_id' lay-verify='user_id' autocomplete='off' placeholder='请输入账号' class='layui-input' value="<%=user_id%>">
      </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">班级</label>
        <div class="layui-input-block">
          <select name="class_id" lay-filter="class_id">
            <option value=""></option>
            <option value="1" >一班</option>
            <option value="2">二班</option>
            <option value="3">三班</option>
          </select>
        </div>
      </div>

      <div class="layui-form-item">
        <label class="layui-form-label">用户角色</label>
        <div class="layui-input-block">
          <input type="radio" name="role" value="1" title="管理员" >
          <input type="radio" name="role" value="2"" title="教师">
          <input type="radio" name="role" value="3" title="学生" checked="">
        </div>
      </div>

    <div class="layui-form-item">
      <label class="layui-form-label">姓名</label>
      <div class="layui-input-block">
        <input type="text" name="name" lay-verify="required" lay-reqtext="用户名是必填项，岂能为空？" placeholder="请输入" autocomplete="off" class="layui-input" value="<%=user_name%>">
      </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-inline">
          <input type="password" name="password" lay-verify="pass" placeholder="请输入密码" autocomplete="off" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">请填写6到12位密码</div>
      </div>
    
    <div class="layui-form-item">
      <div class="layui-inline">
        <label class="layui-form-label">验证手机</label>
        <div class="layui-input-inline">
          <input type="tel" name="phone" lay-verify="required|phone" autocomplete="off" class="layui-input">
        </div>
      </div>
      
      <div class="layui-form-item">
        <label class="layui-form-label">性别</label>
        <div class="layui-input-block">
          <input type="radio" name="sex" value="男" title="男" checked="">
          <input type="radio" name="sex" value="女" title="女">
        </div>
      </div>

      <div class="layui-form-item">
        <label class="layui-form-label">微信号</label>
        <div class="layui-input-block">
          <input type="text" name="wechat" lay-verify="required" lay-reqtext="用户名是必填项，岂能为空？" placeholder="请输入" autocomplete="off" class="layui-input">
        </div>
      </div>

    </div>
    
    <div class="layui-form-item">
      <div class="layui-input-block">
        <button type="text" class="layui-btn btnUpdate" lay-submit="">立即提交</button>
        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
      </div>
    </div>
  </form>         

              
          
<script src="../layui/layui.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
 
<script>
		layui
				.use(
						[ 'form', 'layedit', 'laydate' ],
						function() {
							var $ = layui.jquery, layer = layui.layer;
							var form = layui.form, layer = layui.layer, layedit = layui.layedit, laydate = layui.laydate;

							//日期
							laydate.render({
								elem : '#date'
							});
							laydate.render({
								elem : '#date1'
							});

							//创建一个编辑器
							var editIndex = layedit.build('LAY_demo_editor');

							//自定义验证规则
							form.verify({
								title : function(value) {
									if (value.length < 5) {
										return '账号至少得5个字符啊';
									}
								},
								pass : [ /^[\S]{6,12}$/, '密码必须6到12位，且不能出现空格' ],
								content : function(value) {
									layedit.sync(editIndex);
								}
							});

							//监听提交
 				<%-- 		body.onload(
											function() {
												var user_id = document
												.querySelector(".user_id").value;
												var class_id = document
														.querySelector(".class_id").value;
												var role = document
														.querySelector(".role").value;
											
												var password = document
														.querySelector(".password").value;
												var phone = document
														.querySelector(".phone").value;
												var sex = document
														.querySelector(".sex").value;
												var wechat = document
												.querySelector(".wechat").value;

window.location.href = "http://localhost:8080/OnlineExam/admin/student/m=userUpdate&student?&user_id="+<%=user_id%>+ "&class_id="+ class_id+ "&role="+ role		
													+ "&password="+ password+ "&phone="+ phone+ "&sex="+ sex+ "&wechat="+ wechat;
											}); --%>

					

						});
	</script>

</body>
</html>